package me.minecraft.mod.cobblemonbukkitevent.bukkit.event;

import com.cobblemon.mod.common.api.battles.model.PokemonBattle;
import com.cobblemon.mod.common.api.battles.model.actor.BattleActor;
import com.cobblemon.mod.common.battles.pokemon.BattlePokemon;
import lombok.Getter;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

/**
 * @author langle__
 * @version 1.0
 */
public class PokemonSwitchEndEvent extends Event implements Cancellable {

    private static final HandlerList HANDLERS = new HandlerList();

    @Getter private final PokemonBattle battle;
    @Getter private final BattleActor actor;
    @Getter private final BattlePokemon oldPokemon;
    @Getter private final BattlePokemon newPokemon;

    private boolean cancel;

    public PokemonSwitchEndEvent(PokemonBattle battle, BattleActor actor, BattlePokemon oldPokemon, BattlePokemon newPokemon) {
        this.battle = battle;
        this.actor = actor;
        this.oldPokemon = oldPokemon;
        this.newPokemon = newPokemon;
    }

    @Override
    public boolean isCancelled() {
        return cancel;
    }

    @Override
    public void setCancelled(boolean cancel) {
        this.cancel = cancel;
    }

    @Override
    public @NotNull HandlerList getHandlers() {
        return HANDLERS;
    }

    public static HandlerList getHandlerList() {
        return HANDLERS;
    }

}